﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HRMS_Model;

namespace HRMS.Models.ModelBinders
{
    public class ClientModelBinder : DefaultModelBinder
    {
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var model = (Client)base.BindModel(controllerContext, bindingContext);

            if (controllerContext.HttpContext.Request.Params["id"] != "_empty")
            {
                model.ClientId = Convert.ToInt32(controllerContext.HttpContext.Request.Params["id"]);
            }
            return model;
        }
    }
}